import Vue from 'vue'
import Router from 'vue-router'

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */

/**
 * hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
 *                                if not set alwaysShow, only more than one route under the children
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    title: 'title'               the name show in subMenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar
    breadcrumb: false            if false, the item will hidden in breadcrumb(default is true)
  }
 **/
export const constantRouterMap = [
  { path: '/', redirect: '/login', hidden: true },
  { path: '/login', component: () => import('@/pages/login/index'), hidden: true },
  { path: '/navigation', component: () => import('@/pages/navigation/index'), hidden: true },
  { path: '/404', component: () => import('@/pages/404'), hidden: true },
  // 地图部分
  { path: '/printer', component: () => import('@/pages/yzt/components/oneprinter') },
  {
    path: '/gis',
    redirect: '/gis/yzt',
    component: () => import('@/pages/index'),
    name: 'gis',
    children: [
      // 一张图
      {
        path: '/gis/yzt',
        component: () => import('@/pages/yzt/index'),
        name: 'yzt'
      },
      // 遥感监测
      {
        path: '/gis/ygjc',
        component: () => import('@/pages/xcgl/index'),
        name: 'ygjc'
      },
      // 数据维护
      // {
      //   path: '/gis/sjwh',
      //   component: () => import('@/pages/sjwh/index'),
      //   name: 'sjwh'
      // },
      // 巡查管理
      {
        path: '/gis/xcgl',
        component: () => import('@/pages/xcgl/index'),
        name: 'xcgl'
      },
      //十七大项目的落地地图
      {
        path: '/gis/amap',
        component: () => import('@/pages/amap/index'),
        name: 'amap'
      },
        // 项目展示
        {
          path: '/gis/xmzs',
          component: () => import('@/pages/xmzs/index1'),
          name: 'xmzs'
        },
      {
        path: '/gis/yxwh',
        redirect: '/gis/yxwh/bmgl',
        component: () => import('@/pages/yxwh/index'),
        name: 'yxwh',
        children: [
          {
            path: '/gis/yxwh/bmgl',
            component: () => import('@/pages/yxwh/components/bmgl'),
            name: 'bmgl'
          },
          {
            path: '/gis/yxwh/sxmb',
            hidden: false,
            component: () => import('@/pages/yxwh/components/sxmb'),
            name: 'sxmb'
          },
          {
            path: '/gis/yxwh/rwgl',
            component: () => import('@/pages/yxwh/components/rwgl'),
            name: 'rwgl'
          },
          {
            path: '/gis/yxwh/rwfh',
            component: () => import('@/pages/yxwh/components/rwfh'),
            name: 'rwfh'
          },
          {
            path: '/gis/yxwh/sjml',
            component: () => import('@/pages/yxwh/components/sjml'),
            name: 'sjml'
          },
          {
            path: '/gis/yxwh/qygl',
            component: () => import('@/pages/yxwh/components/qygl'),
            name: 'qygl'
          },
          {
            path: '/gis/yxwh/sjfz',
            component: () => import('@/pages/yxwh/components/sjfz'),
            name: 'sjfz'
          },
          {
            path: '/gis/yxwh/dtsj',
            component: () => import('@/pages/yxwh/components/dtsj'),
            name: 'dtsj'
          },
          {
            path: '/gis/yxwh/slzt',
            component: () => import('@/pages/yxwh/components/slzt'),
            name: 'slzt'
          },
          {
            path: '/gis/yxwh/cjzt',
            component: () => import('@/pages/yxwh/components/cjzt'),
            name: 'cjzt'
          },
          {
            path: '/gis/yxwh/ysfw',
            component: () => import('@/pages/yxwh/components/ysfw'),
            name: 'ysfw'
          },
          {
            path: '/gis/yxwh/ygjc',
            component: () => import('@/pages/yxwh/components/ygjc'),
            name: 'ygjc1'
          },
          {
            path: '/gis/yxwh/jsgl',
            component: () => import('@/pages/yxwh/components/jsgl'),
            name: 'jsgl'
          },
          {
            path: '/gis/yxwh/qxgl',
            component: () => import('@/pages/yxwh/components/qxgl'),
            name: 'qxgl'
          },
          {
            path: '/gis/yxwh/xxwh',
            component: () => import('@/pages/yxwh/components/xxwh'),
            name: 'xxwh'
          },
          {
            path: '/gis/yxwh/jspz',
            component: () => import('@/pages/yxwh/components/jspz'),
            name: 'jspz'
          },
          {
            path: '/gis/yxwh/rwpz',
            component: () => import('@/pages/yxwh/components/rwpz'),
            name: 'rwpz'
          },
          {
            path: '/gis/yxwh/sjpz',
            component: () => import('@/pages/yxwh/components/sjpz'),
            name: 'sjpz'
          },
          {
            path: '/gis/yxwh/sjzd',
            component: () => import('@/pages/yxwh/components/sjzd'),
            name: 'sjzd'
          },
          {
            path: '/gis/yxwh/xtfh',
            component: () => import('@/pages/yxwh/components/xtfh'),
            name: 'xtfh'
          }
        ]
      }
    ]
  }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
